﻿namespace WebShop.Classes.DataSource
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using WebShop.DataService;

    /// <summary>
    /// Working with datasource interface
    /// </summary>
    public interface IDataSource
    {
        /// <summary>
        /// Get children categories list
        /// </summary>
        /// <param name="parentId">Parent category Id</param>
        /// <returns>List of Categories</returns>
        List<CategoryView> GetCategories(int parentId = 0);

        /// <summary>
        /// Get products in selected category
        /// </summary>
        /// <param name="categoryId">Category Id</param>
        /// <param name="page">Page number (begin from 0)</param>
        /// <param name="sort">Sort mode</param>
        /// <param name="filter">Filters dictionary Filter type - Filter params</param>
        /// <param name="placeid">Place id</param>
        /// <returns>List of products</returns>
        List<ProductView> GetCategoryProducts(int categoryId, int page = 0, ProductSort sort = ProductSort.NameAsc, Dictionary<ProductFilter, object> filter = null, int placeid = 0);

        /// <summary>
        /// Get count of pages in category
        /// </summary>
        /// <param name="categoryId">Category id</param>
        /// <returns></returns>
        int GetCategoryPages(int categoryId);
        
        /// <summary>
        /// Get categry info
        /// </summary>
        /// <param name="id">Category Id</param>
        /// <returns>Category info</returns>
        DataService.CategoryView GetCategory(int id);

        /// <summary>
        /// Get product information
        /// </summary>
        /// <param name="id">Product id</param>
        /// <returns>Product info</returns>
        ProductFull GetProduct(long id);

        /// <summary>
        /// Get languages list
        /// </summary>
        /// <returns></returns>
        Dictionary<string, string> GetLanguages();

        /// <summary>
        /// Auth user using login && password
        /// </summary>
        /// <param name="login">Login</param>
        /// <param name="password">Password</param>
        /// <returns>User data or null if error</returns>
        User GetUser(string login, string password);

        /// <summary>
        /// Update user data
        /// </summary>
        /// <param name="user">User data</param>
        /// <returns>Updated user data or null if error</returns>
        User SetUser(User user);

        /// <summary>
        /// Get user data by id
        /// </summary>
        /// <param name="userid">User id</param>
        /// <returns>user data or null if error</returns>
        User GetUser(long userid);

        /// <summary>
        /// Get list of active places
        /// </summary>
        /// <returns>List of places</revturns>
        List<PlaceView> GetPlaces();

        /// <summary>
        /// Create order
        /// </summary>
        /// <param name="order">Order data</param>
        /// <returns>Updated order data</returns>
        OrderFull SetOrder(OrderFull order);

        /// <summary>
        /// Get orders list
        /// </summary>
        /// <returns>Orders list</returns>
        List<OrderView> GetOrders();

        /// <summary>
        /// Get full order data
        /// </summary>
        /// <param name="id">Order id</param>
        /// <returns>Order data or null if error</returns>
        OrderFull GetOrder(long id);
    }
}